<script>
	export default {
		onLaunch: function() {
			let id = uni.getStorageSync('schoolId')
			id ? uni.getStorageSync('schoolId','') : uni.setStorageSync('schoolId', '1');
			
			const systemInfo = wx.getSystemInfoSync()
			const customInfo = wx.getMenuButtonBoundingClientRect() //胶囊按钮位置信息
			// 屏幕高度
			const screenHeight = systemInfo.screenHeight
			// 底部安全距离
			const bottomSafeHeight = (systemInfo.screenHeight - systemInfo.safeArea.bottom)
			// 底部高度 px
			const tabbarSafeheight = (systemInfo.screenHeight - systemInfo.safeArea.bottom) + 50
			// 状态栏高度 px
			const tatusBarHeight = systemInfo.statusBarHeight
			//计算得出导航栏高度
			const navBarHeight = ((customInfo.top || 32 )- tatusBarHeight) * 2 + customInfo.height
			// 顶部固定高度
			const topFixedHeight = tatusBarHeight + navBarHeight
			// body高度
			const bodyHeight = screenHeight - topFixedHeight
			// window
			const windowHeight = screenHeight - topFixedHeight - tabbarSafeheight
			// 转rpx 比例
			const scale = 750 / systemInfo.windowWidth
			// 挂载全局
			uni.$scale = scale
			uni.$screenHeight = screenHeight * scale
			uni.$navBarHeight = navBarHeight * scale
			uni.$tabbarSafeheight = tabbarSafeheight * scale
			uni.$bottomSafeHeight = bottomSafeHeight * scale
			uni.$tatusBarHeight = tatusBarHeight * scale
			uni.$topFixedHeight = topFixedHeight * scale
			uni.$bodyHeight = bodyHeight * scale
			uni.$windowHeight = windowHeight * scale
			console.log('App Launch')
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import 'uview-ui/index.scss';
</style>
